home *** CD-ROM | disk | FTP | other *** search
File List | 1994-10-25 | 3.4 KB | 177 lines |
- MODE 1
- '
- ' Plutonic FLO file mover
- '
- ' This source is copyright! All rights reserved.
- '
- ' If any parts of it are used in other programs, acknowledgement
- ' must be given to Peter Deane (3:622/401)
- '
- argprob%=0
- arg$=_dosCmd$
- arg$=TRIM$(arg$)
- '
- versnum$="$VER: PlutFLOMove 0.2 "
- versnum$="0.2"
- versdate$="25-Oct-94"
- '
- esc$=CHR$(27)
- ansi0$=esc$+"[0m"
- ansi1$=esc$+"[31m"
- ansi2$=esc$+"[32m"
- ansi3$=esc$+"[33m"
- '
- OPEN "O",#1,"*",1
- '
- '
- aa%=INSTR(arg$," ")
- '
- IF aa%=0
- argprob%=1
- ENDIF
- '
- indir$=TRIM$(LEFT$(arg$,aa%))
- outdir$=TRIM$(MID$(arg$,aa%,255))
- '
- IF RIGHT$(indir$,1)<>"/" AND RIGHT$(indir$,1)<>":"
- indir$=indir$+"/"
- ENDIF
- IF RIGHT$(outdir$,1)<>"/" AND RIGHT$(outdir$,1)<>":"
- outdir$=outdir$+"/"
- ENDIF
- '
- IF INSTR(arg$,"?")
- argprob%=9
- ELSE IF LEN(arg$)<3
- argprob%=1
- ELSE IF NOT EXIST(indir$)
- argprob%=2
- ELSE IF NOT EXIST(outdir$)
- argprob%=3
- ENDIF
- '
- PRINT #1,""
- PRINT #1,ansi2$+"------------------------"
- PRINT #1,ansi0$+"Plutonic .?LO File Mover"
- PRINT #1,ansi2$+"------------------------"
- PRINT #1,ansi0$+" Version "+ansi3$+versnum$
- PRINT #1," (c) "+ansi2$+versdate$
- PRINT #1,ansi3$+" By Peter Deane"
- PRINT #1,ansi2$+"------------------------"
- RELSEEK #1,0
- '
- IF argprob%>0
- '
- IF argprob%=1
- PRINT #1,"Short or no directory names given"
- ELSE IF argprob%=2
- PRINT #1,"Source directory does not exist"
- ELSE IF argprob%=3
- PRINT #1,"Output directory does not exist"
- ELSE IF argprob%=9
- PRINT #1,CHR$(34)+"?"+CHR$(34)+" given in command line"
- ENDIF
- PRINT #1,ansi3$+"Usage details: "
- PRINT #1,""
- PRINT #1,ansi0$+"PlutFLOMove "+ital$+"<Source Dir> <Output Dir>"+ansi0$
- GOTO cleanup
- ENDIF
- '
- '
- PRINT #1,"Scanning dir: "+CHR$(34)+indir$+CHR$(34)+"..."
- RELSEEK #1,-1
- '
- DIR indir$ TO "ram:PlutFLOMove.tmp"
- IF NOT EXIST("Ram:PlutFLOMove.tmp")
- PRINT #1,"No files in search directory"
- RELSEEK #1,-1
- GOTO cleanup
- ENDIF
- '
- OPEN "I",#3,"Ram:PlutFLOMove.tmp",1024
- WHILE NOT EOF(#3)
- LINE INPUT #3,xx$
- PRINT #1,ansi3$+xx$;
- @spaceout(xx$,21)
- PRINT #1,SPACE$(spc%);
- RELSEEK #1,-1
- xxu$=UPPER$(xx$)
- ismail!=FALSE
- '
- IF RIGHT$(xxu$,4)=".FLO"
- ismail!=TRUE
- ELSE IF RIGHT$(xxu$,4)=".DLO"
- ismail!=TRUE
- ELSE IF RIGHT$(xxu$,4)=".CLO"
- ismail!=TRUE
- ELSE IF RIGHT$(xxu$,4)=".HLO"
- ismail!=TRUE
- ELSE
- PRINT #1,CHR$(10)+esc$+"[A"+esc$+"[K";
- RELSEEK #1,-1
- GOTO notmail
- ENDIF
- '
- OPEN "I",#9,indir$+xx$,24
- lq%=LOF(#9)
- IF lq%=0
- PRINT #1,CHR$(10)+esc$+"[A"+esc$+"[K";
- RELSEEK #1,-1
- ELSE
- '
- PRINT #1,ansi1$+" -> "+ansi2$+outdir$+xx$
- RELSEEK #1,-1
- IF EXIST(outdir$+xx$)
- OPEN "A",#8,outdir$+xx$
- ELSE
- OPEN "A",#8,outdir$+xx$
- ENDIF
- WHILE NOT EOF(#9)
- LINE INPUT #9,inflo$
- PRINT #8,inflo$
- WEND
- CLOSE #8
- ENDIF
- CLOSE #9
- IF EXIST(indir$+xx$)
- KILL indir$+xx$
- ENDIF
- '
- '
- notmail:
- WEND
- CLOSE #3
- '
- cleanup:
- '
- PRINT #1,""
- PRINT #1,"Peter Deane"+ansi3$+" Fido: "+ansi2$+"3:622/401"+ansi3$
- PRINT #1,"PO Box 228 Swansea NSW 2281 Australia"
- CLOSE #1
- '
- IF EXIST("Ram:PlutFLOMove.tmp")
- KILL "RAM:PlutFLOMove.tmp"
- ENDIF
- END
- '
- PROCEDURE spaceout(thing$,col%)
- '
- LOCAL xx$,xx%,xq%,result%
- xx%=FRE(1)
- ' [Needs the string to format, and the column width it's going to]
- ' [Returns spc% - the number of spaces required - 1 if field overflow]
- '
- xx$=thing$
- xx%=col%
- xq%=LEN(xx$)
- IF xq%>xx%
- result%=1
- ELSE
- result%=(xx%-xq%)
- ENDIF
- spc%=result%
- '
- RETURN
- '
- '
-